---
published_at: 2023-12-11 08:00:00
---

# Announcing Rsbuild v0.2

> December 11, 2023

![](https://assets.rspack.dev/rsbuild/rsbuild-banner-v0-2.png)

The Rsbuild v0.2 contains some incompatible API changes. Please refer to the current documentation for upgrading.

## Targets

We will move the `target` option of `createRsbuild` to rsbuild config, this change allows user to configure `targets` in the rsbuild config file.

- before:

```js
const rsbuild = await createRsbuild({
  target: ['web', 'node'],
});
```

- after:

```js
// rsbuild.config.ts
export default {
  output: {
    targets: ['web', 'node'],
  },
};
```

> Only affect JavaScript API. Users using the Rsbuild CLI do not need to change.

## Entry

Remove the deprecated `source.entries` config.

`source.entries` has been renamed to `source.entry` since Rsbuild v0.1.0, and we will remove the legacy `source.entries` config in Rsbuild v0.2.0.

- before:

```js
// rsbuild.config.ts
export default {
  source: {
    entries: {},
  },
};
```

- after:

```js
// rsbuild.config.ts
export default {
  source: {
    entry: {},
  },
};
```

## Write to Disk

`dev.writeToDisk` defaults to `false`.

Motivation:

- Reduce fs overhead and improve dev server performance.
- Avoid trigger watcher of UnoCSS and other tools. See [#654](https://github.com/web-infra-dev/rsbuild/issues/654).
- Align the default behavior with webpack-dev-middleware and other community dev servers.

User can enable writeToDisk manually:

```js
export default {
  dev: {
    writeToDisk: true,
  },
};
```

## Babel Plugin

`@rsbuild/plugin-babel` will move all babel-loader options to `babelLoaderOptions`:

- before:

```ts
pluginBabel({
  plugins: [],
  presets: [],
});
```

- after:

```ts
pluginBabel([
  babelLoaderOptions: {
    plugins: [],
    presets: [],
  }
]);
```

This change allows us to add more options for `pluginBabel`, such as `include` and `exclude`.

## Source Map

`output.disableSourceMap` has been renamed to `output.sourceMap`.

- before:

```js
export default {
  output: {
    disableSourceMap: {
      js: true,
      css: true,
    },
  },
};
```

- after:

```js
export default {
  output: {
    sourceMap: {
      js: false,
      css: false,
    },
  },
};
```

The default value of source map has also been updated to improve build performance.

- before: generate JS / CSS source map in development, generate JS source map in production.
- after: generate JS source map in development, no source map are generated in production.

## Inject Styles

Rename `output.disableCssExtract` to `output.injectStyles` to be clearer:

- before:

```js
export default {
  output: {
    disableCssExtract: true,
  },
};
```

- after:

```js
export default {
  output: {
    injectStyles: true,
  },
};
```
